package cn.donting.jme.edit.util;

import cn.donting.jme.edit.ex.imp.DefaultIconResourcesLoader;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

import java.net.URL;

/**
 * Icon 工具类
 */
public class IconUtils {

    public static Image getImage(String name){
        ClassLoader classLoader = DefaultIconResourcesLoader.class.getClassLoader();
        URL resource = classLoader.getResource(name);
        Image image = new Image(resource.toString());
        return image;
    }
    public static ImageView getImageView(String name){
        ClassLoader classLoader = DefaultIconResourcesLoader.class.getClassLoader();
        URL resource = classLoader.getResource(name);
        Image image = new Image(resource.toString());
        ImageView imageView = new ImageView(image);
        return imageView;
    }
}
